package com.kgc.crowd.ossdemo.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class OSSProperties implements InitializingBean {
    @Value("${oss.file.endpoint}")
    String endpoint;
    @Value("${oss.file.accessKeyId}")
    String accessKeyId;
    @Value("${oss.file.accessKeySecret}")
    String accessKeySecret;
    @Value("${oss.file.bucketName}")
    String bucketName;
    @Value("${oss.file.folderName}")
    String folderName;

    public static String ENDPOINT;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;
    public static String FOLDER_NAME;


    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT=endpoint;
        ACCESS_KEY_ID=accessKeyId;
        ACCESS_KEY_SECRET=accessKeySecret;
        BUCKET_NAME=bucketName;
        FOLDER_NAME=folderName;
    }
}
